home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Camelot
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip
/
Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf
/
XLisp-Stat
/
Book
/
projection.lsp
< prev
next >
Wrap
Lisp/Scheme
|
1990-10-11
|
715b
|
29 lines
; book p.96
#|(defun make-projection (x)
(flet ((ip (x y) (sum (* x y))))
#'(lambda (y) (* x (/ (ip x y) (ip x x))))))
|#
#|
(defun make-projection (x)
(labels ((ip (x y) (sum (* x y)))
(proj (y) (* x (/ (ip x y) (ip x x)))))
#'proj))
(def p (make-projection '(1 1 1 1)))
|#
; book p.172
(defun make-projection (cols)
(let* ((x (if (matrixp cols)
cols
(apply #'bind-columns cols)))
(svd (sv-decomp x))
(u (first svd))
(s-vals (second svd))
(basis (select (column-list u)
(which (> s-vals 0.0))))
(u1 (apply #'bind-columns basis)))
#'(lambda (y) (matmult u1 (matmult y u1)))))